/*
* Copyright 2017 Yonyou Auto Information Technology（Shanghai） Co., Ltd. All Rights Reserved.
*
* This software is published under the terms of the YONYOU Software
* License version 1.0, a copy of which has been included with this
* distribution in the LICENSE.txt file.
*
* @Project Name : marketing-common
*
* @File name : SendToMQ.java
*
* @Author : Administrator
*
* @Date : 2017年7月20日
*
----------------------------------------------------------------------------------
*     Date       Who       Version     Comments
* 1. 2017年7月20日    Administrator    1.0
*
*
*
*
----------------------------------------------------------------------------------
*/
	
package org.marketing.common.mq;

import org.apache.log4j.Logger;
import org.bouncycastle.eac.EACException;
import org.marketing.common.dto.SendTicket;
import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.fastjson.JSON;
import com.yonyou.gmmc.common.service.BaseService;
import com.yonyou.gmmc.common.service.BaseService.MQChannelType;


/**
*
* @author Administrator
* TODO description
* @date 2017年7月20日
*/

public class SendToMQ {
    
    private static Logger logger = Logger.getLogger(SendToMQ.class);

    @Autowired
    private static BaseService               eventService;
    
    public static String sendTicket(SendTicket ticketDto) throws Exception {
        String s = "";
        try{
            String param = JSON.toJSONString(ticketDto).toString();
            logger.info("参数为："+param);
            s = eventService.sendMessage2MQ(MQChannelType.appTicket, param);
            logger.info("MQ返回结果>>>>>>>>>>>>>>>>>>>>" + s);
            return s;
        }catch (Exception e){
            logger.error("发送异常："+e.getMessage(),e);
            throw new EACException(e.getMessage(), e);
        }
    }
}
